package com.jt.controller;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import redis.clients.jedis.Jedis;

@Controller
public class TestController {
	
	@RequestMapping("/hello")
	@ResponseBody
	public String hello() {
		return "hello hh";
	}
	
	@RequestMapping("/jedis/{key}/{value}")
	@ResponseBody
	public String testJedis(@PathVariable String key, @PathVariable String value) {
		Jedis jedis = new Jedis("192.168.1.106", 6379);
		jedis.set(key, value);
		
		return "ok";
	}
	
	@RequestMapping("/jedis_list/{listkey}")
	@ResponseBody
	public List<String> getListValue(@PathVariable String listkey) {
		Jedis jedis = new Jedis("192.168.1.106", 6379);
		List<String> list = jedis.brpop(0, listkey);
		
		return list;
	}
}
